#include<bits/stdc++.h>
using namespace std;

#define rint register int
const int maxn = 8005;
int n, q;
int a[maxn], idp[maxn];

inline int read ()
{
	int x = 1, s = 0;
	char ch = getchar ();
	while (ch < '0' or ch > '9')
	{
		if (ch == '-')
			x = -1;
		ch = getchar ();
	}
	while (ch >= '0' and ch <= '9')
		s = s * 10 + ch - '0', ch = getchar ();
	return x * s;
}

inline void srt ()
{
	for (rint i (1); i <= n; ++i)
		idp[i] = i;
	for (rint i (1); i <= n; ++i)
		for (rint j (i); j >= 2; --j)
			if (a[idp[j]] < a[idp[j - 1]])
				swap (idp[j], idp[j - 1]);
}

//inline void srt2 (int x)
//{
////	for (rint i (1); i <= n; ++i)
////		idp[i] = i;
//	int i = x;
//	for (rint j (i); j >= 2; --j)
//		if (a[idp[j]] < a[idp[j - 1]])
//			swap (idp[j], idp[j - 1]);
//	for (rint j (i); j <= n; ++j)
//		if (a[idp[j]] > a[idp[j - 1]])
//			swap (idp[j], idp[j - 1]);
//}

inline int fnd (int x)
{
	for (rint i (1); i <= n; ++i)
		if (idp[i] == x) 
			return i;
}

int main ()
{
	freopen ("sort.in", "r", stdin); freopen ("sort.out", "w", stdout);
	n = read (), q = read ();
	for (rint i (1); i <= n; ++i)
		a[i] = read ();
//	srt ();
	for (rint i (1); i <= q; ++i)
	{
		int pos = read ();
		int x = read ();
		if (pos == 1)
			a[x] = read ();
		else if (pos == 2)
		{
			srt ();
			printf ("%d\n", fnd (x));
		}
	}
	return 0;
}
/*
3 4
3 2 1
2 3
1 3 2
2 2
2 3
*/
